home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / tar.gnu / sprite / RCS / diffarch.c,v < prev    next >
Encoding:
Text File  |  1992-03-29  |  16.7 KB  |  821 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     92.03.28.17.31.41;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     90.06.28.15.35.44;  author rab;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     90.03.23.10.28.20;  author rab;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @@
  27.  
  28.  
  29. 1.3
  30. log
  31. @Restructure to remove some of the ALLOW_LONG_NAMES ifdefs.  Fix to
  32. allow both a long file name and a long link name.  Check for Posix
  33. archives.
  34. @
  35. text
  36. @/* Diff files from a tar archive.
  37.    Copyright (C) 1988 Free Software Foundation
  38.  
  39. This file is part of GNU Tar.
  40.  
  41. GNU Tar is free software; you can redistribute it and/or modify
  42. it under the terms of the GNU General Public License as published by
  43. the Free Software Foundation; either version 1, or (at your option)
  44. any later version.
  45.  
  46. GNU Tar is distributed in the hope that it will be useful,
  47. but WITHOUT ANY WARRANTY; without even the implied warranty of
  48. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  49. GNU General Public License for more details.
  50.  
  51. You should have received a copy of the GNU General Public License
  52. along with GNU Tar; see the file COPYING.  If not, write to
  53. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  54.  
  55. /*
  56.  * Diff files from a tar archive.
  57.  *
  58.  * Written 30 April 1987 by John Gilmore, ihnp4!hoptoad!gnu.
  59.  *
  60.  * @@(#) diffarch.c 1.10 87/11/11 - gnu
  61.  */
  62.  
  63. #include <stdio.h>
  64. #include <errno.h>
  65. #include <sys/types.h>
  66. #include <sys/stat.h>
  67. #include <sys/param.h>
  68.  
  69. #ifdef BSD42
  70. #include <sys/file.h>
  71. #endif
  72.  
  73. #ifndef MSDOS
  74. #include <sys/ioctl.h>
  75. #ifndef USG
  76. #include <sys/mtio.h>
  77. #endif
  78. #endif
  79.  
  80. #ifdef USG
  81. #include <fcntl.h>
  82. #endif
  83.  
  84. /* Some systems don't have these #define's -- we fake it here. */
  85. #ifndef O_RDONLY
  86. #define    O_RDONLY    0
  87. #endif
  88. #ifndef    O_NDELAY
  89. #define    O_NDELAY    0
  90. #endif
  91.  
  92. #ifndef S_IFLNK
  93. #define lstat stat
  94. #endif
  95.  
  96. extern int errno;            /* From libc.a */
  97. extern char *valloc();            /* From libc.a */
  98.  
  99. #include "tar.h"
  100. #include "port.h"
  101. #include "rmt.h"
  102.  
  103. extern union record *head;        /* Points to current tape header */
  104. extern struct stat hstat;        /* Stat struct corresponding */
  105. extern int head_standard;        /* Tape header is in ANSI format */
  106.  
  107. extern void print_header();
  108. extern void skip_file();
  109. extern void skip_extended_headers();
  110.  
  111. extern FILE *msg_file;
  112.  
  113. int now_verifying = 0;        /* Are we verifying at the moment? */
  114.  
  115. char    *diff_name;        /* head->header.name */
  116.  
  117. int    diff_fd;        /* Descriptor of file we're diffing */
  118.  
  119. char    *diff_buf = 0;        /* Pointer to area for reading
  120.                        file contents into */
  121.  
  122. char    *diff_dir;        /* Directory contents for LF_DUMPDIR */
  123.  
  124. int different = 0;
  125.  
  126. /*struct sp_array *sparsearray;
  127. int         sp_ar_size = 10;*/
  128. /*
  129.  * Initialize for a diff operation
  130.  */
  131. diff_init()
  132. {
  133.  
  134.     /*NOSTRICT*/
  135.     diff_buf = (char *) valloc((unsigned)blocksize);
  136.     if (!diff_buf) {
  137.         msg("could not allocate memory for diff buffer of %d bytes\n",
  138.             blocksize);
  139.         exit(EX_ARGSBAD);
  140.     }
  141. }
  142.  
  143. /*
  144.  * Diff a file against the archive.
  145.  */
  146. void
  147. diff_archive()
  148. {
  149.     register char *data;
  150.     int check, namelen;
  151.     int err;
  152.     long offset;
  153.     struct stat filestat;
  154. #ifdef ALLOW_LONG_NAMES    
  155.     char linkbuf[MAXPATHLEN+3];
  156. #else    
  157.     char linkbuf[NAMSIZ+3];
  158. #endif    
  159.     int compare_chunk();
  160.     int compare_dir();
  161.     dev_t    dev;
  162.     ino_t    ino;
  163.     char *get_dir_contents();
  164.     long from_oct();
  165.     long lseek();
  166.  
  167.     errno = EPIPE;            /* FIXME, remove perrors */
  168.  
  169.     decode_header(head, &hstat, &head_standard, 1);    /* Snarf fields */
  170.  
  171.     /* Print the record from 'head' and 'hstat' */
  172.     if (f_verbose) {
  173.         if(now_verifying)
  174.             fprintf(msg_file,"Verify ");
  175.         print_header();
  176.     }
  177.     diff_name = current_filename;
  178.     switch (head->header.linkflag) {
  179.  
  180.     default:
  181.         msg("Unknown file type '%c' for %s, diffed as normal file\n",
  182.             head->header.linkflag, diff_name);
  183.         /* FALL THRU */
  184.  
  185.     case LF_OLDNORMAL:
  186.     case LF_NORMAL:
  187.     case LF_SPARSE:
  188.     case LF_CONTIG:
  189.         /*
  190.          * Appears to be a file.
  191.          * See if it's really a directory.
  192.          */
  193.         namelen = strlen(diff_name)-1;
  194.         if (diff_name[namelen] == '/')
  195.             goto really_dir;
  196.  
  197.         if(do_stat(&filestat)) {
  198.             if (gnu_extended_header(head))
  199.                 skip_extended_headers();
  200.             skip_file((long)hstat.st_size);
  201.             different++;
  202.             goto quit;
  203.         }
  204.  
  205.         if ((filestat.st_mode & S_IFMT) != S_IFREG) {
  206.             fprintf(msg_file, "%s: not a regular file\n",
  207.                 diff_name);
  208.             skip_file((long)hstat.st_size);
  209.             different++;
  210.             goto quit;
  211.         }
  212.  
  213.         filestat.st_mode &= ~S_IFMT;
  214.         if (filestat.st_mode != hstat.st_mode)
  215.             sigh("mode");
  216.         if (filestat.st_uid  != hstat.st_uid)
  217.             sigh("uid");
  218.         if (filestat.st_gid  != hstat.st_gid)
  219.             sigh("gid");
  220.         if (filestat.st_mtime != hstat.st_mtime)
  221.             sigh("mod time");
  222.         if (head->header.linkflag != LF_SPARSE &&
  223.                 filestat.st_size != hstat.st_size) {
  224.             sigh("size");
  225.             skip_file((long)hstat.st_size);
  226.             goto quit;
  227.         }
  228.  
  229.         diff_fd = open(diff_name, O_NDELAY|O_RDONLY);
  230.  
  231.         if (diff_fd < 0) {
  232.             msg_perror("cannot open %s",diff_name);
  233.             if (gnu_extended_header(head))
  234.                 skip_extended_headers();
  235.             skip_file((long)hstat.st_size);
  236.             different++;
  237.             goto quit;
  238.         }
  239.         /*
  240.          * Need to treat sparse files completely differently here.
  241.          */
  242.         if (head->header.linkflag == LF_SPARSE) {
  243. /*            long end_nulls;
  244.             
  245.             end_nulls = from_oct(1+12, head->header.ending_blanks);*/
  246.             diff_sparse_files(hstat.st_size);
  247.         }
  248.         else 
  249.             wantbytes((long)(hstat.st_size),compare_chunk);
  250.  
  251.         check = close(diff_fd);
  252.         if (check < 0) {
  253.             msg_perror("Error while closing %s",diff_name);
  254.         }
  255.  
  256.     quit:
  257.         break;
  258.  
  259.     case LF_LINK:
  260.         if(do_stat(&filestat))
  261.             break;
  262.         dev = filestat.st_dev;
  263.         ino = filestat.st_ino;
  264.         err = stat(current_linkname, &filestat);
  265.         if (err < 0) {
  266.             if (errno==ENOENT) {
  267.                 fprintf(msg_file, "%s: does not exist\n",diff_name);
  268.             } else {
  269.                 msg_perror("cannot stat file %s",diff_name);
  270.             }
  271.             different++;
  272.             break;
  273.         }
  274.         if(filestat.st_dev!=dev || filestat.st_ino!=ino) {
  275.             fprintf(msg_file, "%s not linked to %s\n", diff_name,
  276.                 current_linkname);
  277.             break;
  278.         }
  279.         break;
  280.  
  281. #ifdef S_IFLNK
  282.     case LF_SYMLINK:
  283.         check = readlink(diff_name, linkbuf,
  284.                  (sizeof linkbuf)-1);
  285.         
  286.         if (check < 0) {
  287.             if (errno == ENOENT) {
  288.                 fprintf(msg_file,
  289.                     "%s: no such file or directory\n",
  290.                     diff_name);
  291.             } else {
  292.                 msg_perror("cannot read link %s",diff_name);
  293.             }
  294.             different++;
  295.             break;
  296.         }
  297.  
  298.         linkbuf[check] = '\0';    /* Null-terminate it */
  299.         if (strncmp(current_linkname, linkbuf, check) != 0) {
  300.             fprintf(msg_file, "%s: symlink differs\n",
  301.                 current_linkname);
  302.             different++;
  303.         }
  304.         break;
  305. #endif
  306.  
  307.     case LF_CHR:
  308.         hstat.st_mode |= S_IFCHR;
  309.         goto check_node;
  310.  
  311. #ifdef S_IFBLK
  312.     /* If local system doesn't support block devices, use default case */
  313.     case LF_BLK:
  314.         hstat.st_mode |= S_IFBLK;
  315.         goto check_node;
  316. #endif
  317.  
  318. #ifdef S_IFIFO
  319.     /* If local system doesn't support FIFOs, use default case */
  320.     case LF_FIFO:
  321.         hstat.st_mode |= S_IFIFO;
  322.         hstat.st_rdev = 0;        /* FIXME, do we need this? */
  323.         goto check_node;
  324. #endif
  325.  
  326.     check_node:
  327.         /* FIXME, deal with umask */
  328.         if(do_stat(&filestat))
  329.             break;
  330.         if(hstat.st_rdev != filestat.st_rdev) {
  331.             fprintf(msg_file, "%s: device numbers changed\n", diff_name);
  332.             different++;
  333.             break;
  334.         }
  335.         if(hstat.st_mode != filestat.st_mode) {
  336.             fprintf(msg_file, "%s: mode or device-type changed\n", diff_name);
  337.             different++;
  338.             break;
  339.         }
  340.         break;
  341.  
  342.     case LF_DUMPDIR:
  343.         data=diff_dir=get_dir_contents(diff_name,0);
  344.         wantbytes((long)(hstat.st_size),compare_dir);
  345.         free(data);
  346.         /* FALL THROUGH */
  347.  
  348.     case LF_DIR:
  349.         /* Check for trailing / */
  350.         namelen = strlen(diff_name)-1;
  351.     really_dir:
  352.         while (namelen && diff_name[namelen] == '/')
  353.             diff_name[namelen--] = '\0';    /* Zap / */
  354.  
  355.         if(do_stat(&filestat))
  356.             break;
  357.         if((filestat.st_mode&S_IFMT)!=S_IFDIR) {
  358.             fprintf(msg_file, "%s is no longer a directory\n",diff_name);
  359.             different++;
  360.             break;
  361.         }
  362.         if((filestat.st_mode&~S_IFMT) != hstat.st_mode)
  363.             sigh("mode");
  364.         break;
  365.  
  366.     case LF_VOLHDR:
  367.         break;
  368.  
  369.     case LF_MULTIVOL:
  370.         namelen = strlen(diff_name)-1;
  371.         if (diff_name[namelen] == '/')
  372.             goto really_dir;
  373.  
  374.         if(do_stat(&filestat))
  375.             break;
  376.  
  377.         if ((filestat.st_mode & S_IFMT) != S_IFREG) {
  378.             fprintf(msg_file, "%s: not a regular file\n",
  379.                 diff_name);
  380.             skip_file((long)hstat.st_size);
  381.             different++;
  382.             break;
  383.         }
  384.  
  385.         filestat.st_mode &= ~S_IFMT;
  386.         offset = from_oct(1+12, head->header.offset);
  387.         if (filestat.st_size != hstat.st_size + offset) {
  388.             sigh("size");
  389.             skip_file((long)hstat.st_size);
  390.             different++;
  391.             break;
  392.         }
  393.  
  394.         diff_fd = open(diff_name, O_NDELAY|O_RDONLY);
  395.  
  396.         if (diff_fd < 0) {
  397.             msg_perror("cannot open file %s",diff_name);
  398.             skip_file((long)hstat.st_size);
  399.             different++;
  400.             break;
  401.         }
  402.         err = lseek(diff_fd, offset, 0);
  403.         if(err!=offset) {
  404.             msg_perror("cannot seek to %ld in file %s",offset,diff_name);
  405.             different++;
  406.             break;
  407.         }
  408.  
  409.         wantbytes((long)(hstat.st_size),compare_chunk);
  410.  
  411.         check = close(diff_fd);
  412.         if (check < 0) {
  413.             msg_perror("Error while closing %s",diff_name);
  414.         }
  415.         break;
  416.  
  417.     }
  418. }
  419.  
  420. int
  421. compare_chunk(bytes,buffer)
  422. long bytes;
  423. char *buffer;
  424. {
  425.     int err;
  426.  
  427.     err=read(diff_fd,diff_buf,bytes);
  428.     if(err!=bytes) {
  429.         if(err<0) {
  430.             msg_perror("can't read %s",diff_name);
  431.         } else {
  432.             fprintf(msg_file,"%s: could only read %d of %d bytes\n",diff_name,err,bytes);
  433.         }
  434.         different++;
  435.         return -1;
  436.     }
  437.     if(bcmp(buffer,diff_buf,bytes)) {
  438.         fprintf(msg_file, "%s: data differs\n",diff_name);
  439.         different++;
  440.         return -1;
  441.     }
  442.     return 0;
  443. }
  444.  
  445. int
  446. compare_dir(bytes,buffer)
  447. long bytes;
  448. char *buffer;
  449. {
  450.     if(bcmp(buffer,diff_dir,bytes)) {
  451.         fprintf(msg_file, "%s: data differs\n",diff_name);
  452.         different++;
  453.         return -1;
  454.     }
  455.     diff_dir+=bytes;
  456.     return 0;
  457. }
  458.  
  459. /*
  460.  * Sigh about something that differs.
  461.  */
  462. sigh(what)
  463.     char *what;
  464. {
  465.  
  466.     fprintf(msg_file, "%s: %s differs\n",
  467.         diff_name, what);
  468. }
  469.  
  470. verify_volume()
  471. {
  472.     int status;
  473. #ifdef MTIOCTOP
  474.     struct mtop t;
  475.     int er;
  476. #endif
  477.  
  478.     if(!diff_buf)
  479.         diff_init();
  480. #ifdef MTIOCTOP
  481.     t.mt_op = MTBSF;
  482.     t.mt_count = 1;
  483.     if((er=rmtioctl(archive,MTIOCTOP,&t))<0) {
  484.         if(errno!=EIO || (er=rmtioctl(archive,MTIOCTOP,&t))<0) {
  485. #endif
  486.             if(rmtlseek(archive,0L,0)!=0) {
  487.                 /* Lseek failed.  Try a different method */
  488.                 msg_perror("Couldn't rewind archive file for verify");
  489.                 return;
  490.             }
  491. #ifdef MTIOCTOP
  492.         }
  493.     }
  494. #endif
  495.     ar_reading=1;
  496.     now_verifying = 1;
  497.     fl_read();
  498.     for(;;) {
  499.         status = read_header();
  500.         if(status==0) {
  501.             unsigned n;
  502.  
  503.             n=0;
  504.             do {
  505.                 n++;
  506.                 status=read_header();
  507.             } while(status==0);
  508.             msg("VERIFY FAILURE: %d invalid header%s detected!",n,n==1?"":"s");
  509.         }
  510.         if(status==2 || status==EOF)
  511.             break;
  512.         saverec(&head);
  513.         userec(head);
  514.         get_names(head);
  515.         diff_archive();
  516.         saverec((union record **)0);
  517.     }
  518.     ar_reading=0;
  519.     now_verifying = 0;
  520.  
  521. }
  522.  
  523. int do_stat(statp)
  524. struct stat *statp;
  525. {
  526.     int err;
  527.  
  528.     err = f_follow_links ? stat(diff_name, statp) : lstat(diff_name, statp);
  529.     if (err < 0) {
  530.         if (errno==ENOENT) {
  531.             fprintf(msg_file, "%s: does not exist\n",diff_name);
  532.         } else
  533.             msg_perror("can't stat file %s",diff_name);
  534. /*        skip_file((long)hstat.st_size);
  535.         different++;*/
  536.         return 1;
  537.     } else
  538.         return 0;
  539. }
  540.  
  541. /*
  542.  * JK
  543.  * Diff'ing a sparse file with its counterpart on the tar file is a 
  544.  * bit of a different story than a normal file.  First, we must know
  545.  * what areas of the file to skip through, i.e., we need to contruct
  546.  * a sparsearray, which will hold all the information we need.  We must
  547.  * compare small amounts of data at a time as we find it.  
  548.  */
  549.  
  550. diff_sparse_files(filesize)
  551. int    filesize;
  552.  
  553. {
  554.     int        sparse_ind = 0;
  555.     char        *buf;
  556.     int        buf_size = RECORDSIZE;
  557.     union record     *datarec;    
  558.     int        err;
  559.     long        numbytes;
  560.     int        amt_read = 0;
  561.     int        size = filesize;
  562.  
  563.     buf = (char *) malloc(buf_size * sizeof (char));
  564.     
  565.     fill_in_sparse_array();
  566.     
  567.  
  568.     while (size > 0) {
  569.         datarec = findrec();
  570.         if (!sparsearray[sparse_ind].numbytes)
  571.             break;
  572.  
  573.         /*
  574.          * 'numbytes' is nicer to write than
  575.          * 'sparsearray[sparse_ind].numbytes' all the time ...
  576.          */
  577.         numbytes = sparsearray[sparse_ind].numbytes;
  578.         
  579.         lseek(diff_fd, sparsearray[sparse_ind].offset, 0);
  580.         /*
  581.          * take care to not run out of room in our buffer
  582.          */
  583.         while (buf_size < numbytes) {
  584.             buf = (char *) realloc(buf, buf_size * 2 * sizeof(char));
  585.             buf_size *= 2;
  586.         }
  587.         while (numbytes > RECORDSIZE) {
  588.             if ((err = read(diff_fd, buf, RECORDSIZE)) != RECORDSIZE) {
  589.                  if (err < 0) 
  590.                     msg_perror("can't read %s", diff_name);
  591.                 else
  592.                     fprintf(msg_file, "%s: could only read %d of %d bytes\n", 
  593.                         err, numbytes);
  594.                 break;
  595.             }
  596.             if (bcmp(buf, datarec->charptr, RECORDSIZE)) {
  597.                 different++;
  598.                 break;
  599.             }
  600.             numbytes -= err;
  601.             size -= err;
  602.             userec(datarec);
  603.             datarec = findrec();
  604.         }
  605.         if ((err = read(diff_fd, buf, numbytes)) != numbytes) {
  606.              if (err < 0) 
  607.                 msg_perror("can't read %s", diff_name);
  608.             else
  609.                 fprintf(msg_file, "%s: could only read %d of %d bytes\n", 
  610.                         err, numbytes);
  611.             break;
  612.         }
  613.  
  614.         if (bcmp(buf, datarec->charptr, numbytes)) {
  615.             different++;
  616.             break;
  617.         }
  618. /*        amt_read += numbytes;
  619.         if (amt_read >= RECORDSIZE) {
  620.             amt_read = 0;
  621.             userec(datarec);
  622.             datarec = findrec();
  623.         }*/
  624.         userec(datarec);
  625.         sparse_ind++;
  626.         size -= numbytes;
  627.     }
  628.     /* 
  629.      * if the number of bytes read isn't the
  630.      * number of bytes supposedly in the file,
  631.      * they're different
  632.      */
  633. /*    if (amt_read != filesize)
  634.         different++;*/
  635.     userec(datarec);
  636.     if (different)
  637.         fprintf(msg_file, "%s: data differs\n", diff_name);
  638.  
  639. }
  640.  
  641. /*
  642.  * JK
  643.  * This routine should be used more often than it is ... look into
  644.  * that.  Anyhow, what it does is translate the sparse information
  645.  * on the header, and in any subsequent extended headers, into an
  646.  * array of structures with true numbers, as opposed to character
  647.  * strings.  It simply makes our life much easier, doing so many
  648.  * comparisong and such.
  649.  */
  650. fill_in_sparse_array()
  651. {
  652.     int     ind;
  653.  
  654.     /*
  655.      * allocate space for our scratch space; it's initially
  656.      * 10 elements long, but can change in this routine if
  657.      * necessary
  658.      */
  659.     sp_array_size = 10;
  660.     sparsearray = (struct sp_array *) malloc(sp_array_size * sizeof(struct sp_array));
  661.  
  662.     /*
  663.      * there are at most five of these structures in the header
  664.      * itself; read these in first
  665.      */
  666.     for (ind = 0; ind < SPARSE_IN_HDR; ind++) {
  667.         if (!head->header.sp[ind].numbytes)
  668.             break;
  669.         sparsearray[ind].offset =
  670.             from_oct(1+12, head->header.sp[ind].offset);
  671.         sparsearray[ind].numbytes =
  672.             from_oct(1+12, head->header.sp[ind].numbytes);
  673.     }
  674.     /*
  675.      * if the header's extended, we gotta read in exhdr's till
  676.      * we're done
  677.      */
  678.     if (gnu_extended_header(head)) {
  679.          /* how far into the sparsearray we are 'so far' */
  680.         static int so_far_ind = SPARSE_IN_HDR;    
  681.         union record *exhdr;
  682.            
  683.         for (;;) {
  684.         exhdr = findrec();
  685.         for (ind = 0; ind < SPARSE_EXT_HDR; ind++) {
  686.             if (ind+so_far_ind > sp_array_size-1) {
  687.                 /*
  688.                   * we just ran out of room in our
  689.                  *  scratch area - realloc it
  690.                   */
  691.                 sparsearray = (struct sp_array *)
  692.                     realloc(sparsearray, 
  693.                         sp_array_size*2*sizeof(struct sp_array));
  694.                 sp_array_size *= 2;
  695.             }
  696.             /*
  697.              * convert the character strings into longs
  698.              */
  699.             sparsearray[ind+so_far_ind].offset = 
  700.                 from_oct(1+12, exhdr->ext_hdr.xh_sp[ind].offset);
  701.             sparsearray[ind+so_far_ind].numbytes =
  702.                 from_oct(1+12, exhdr->ext_hdr.xh_sp[ind].numbytes);
  703.         }
  704.         /* 
  705.          * if this is the last extended header for this
  706.          * file, we can stop
  707.          */
  708.         if (!exhdr->ext_hdr.xh_isextended)
  709.             break;
  710.         else {
  711.             so_far_ind += SPARSE_EXT_HDR;
  712.             userec(exhdr);
  713.         }
  714.         }
  715.         /* be sure to skip past the last one  */
  716.         userec(exhdr);
  717.     }
  718. }
  719. @
  720.  
  721.  
  722. 1.2
  723. log
  724. @Added support for long filenames and long symbolic linkes.
  725. @
  726. text
  727. @a74 3
  728. #ifdef ALLOW_LONG_NAMES
  729. extern char *get_long_name();
  730. #endif
  731. a133 2
  732.     saverec(&head);            /* Make sure it sticks around */
  733.     userec(head);            /* And go past it in the archive */
  734. d142 1
  735. a142 5
  736. #ifdef ALLOW_LONG_NAMES
  737.     diff_name = get_long_name(head, XH_FILENAME);
  738. #else    
  739.     diff_name = head->header.name;
  740. #endif    
  741. a161 1
  742.         
  743. d163 1
  744. a163 1
  745.             if (head->header.isextended)
  746. d198 1
  747. a198 1
  748.             if (head->header.isextended)
  749. d229 1
  750. a229 5
  751. #ifdef ALLOW_LONG_NAMES
  752.         err = stat(get_long_name(head, XH_LINKNAME), &filestat);
  753. #else        
  754.         err = stat(head->header.linkname, &filestat);
  755. #endif        
  756. d240 2
  757. a241 6
  758.             fprintf(msg_file, "%s not linked to %s\n",    diff_name,
  759. #ifdef ALLOW_LONG_NAMES
  760.             get_long_name(head, XH_LINKNAME));
  761. #else
  762.             head->header.linkname);
  763. #endif            
  764. d264 1
  765. a264 3
  766. #ifdef ALLOW_LONG_NAMES
  767.         if (strncmp(get_long_name(head, XH_LINKNAME),
  768.             linkbuf, check) != 0) {
  769. d266 1
  770. a266 1
  771.                 get_long_name(head, XH_LINKNAME));
  772. a267 6
  773. #else        
  774.         if (strncmp(head->header.linkname, linkbuf, check) != 0) {
  775.             fprintf(msg_file, "%s: symlink differs\n",
  776.                 head->header.linkname);
  777.             different++;
  778. #endif            
  779. a382 3
  780.  
  781.     /* We don't need to save it any longer. */
  782.     saverec((union record **) 0);    /* Unsave it */
  783. d477 3
  784. d481 1
  785. d643 1
  786. a643 1
  787.     if (head->header.isextended) {
  788. @
  789.  
  790.  
  791. 1.1
  792. log
  793. @Initial revision
  794. @
  795. text
  796. @d32 1
  797. d75 3
  798. d122 3
  799. d126 1
  800. d147 3
  801. a149 1
  802.  
  803. d151 1
  804. d239 3
  805. d243 1
  806. d254 6
  807. a259 1
  808.             fprintf(msg_file, "%s not linked to %s\n",diff_name,head->header.linkname);
  809. d282 7
  810. d293 1
  811. d690 1
  812. a690 1
  813.                 from_oct(1+12, exhdr->ext_hdr.sp[ind].offset);
  814. d692 1
  815. a692 1
  816.                 from_oct(1+12, exhdr->ext_hdr.sp[ind].numbytes);
  817. d698 1
  818. a698 1
  819.         if (!exhdr->ext_hdr.isextended)
  820. @
  821.